package com.li.algorithm.leetcode.hot100;

import java.util.Arrays;

public class Test4 {
    public void moveZeroes(int[] nums) {
        int count = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] == 0) {
                count++;
                continue;
            }
            nums[i-count] = nums[i];
            if (count != 0) nums[i] = 0;
        }
        System.out.println(Arrays.toString(nums));
    }

    public static void main(String[] args) {
        Test4 test4 = new Test4();
        int[] nums = {0,1,0,3,12};
        test4.moveZeroes(nums);
    }
}
